import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
import java.io.IOException;
import java.util.Scanner;

/**
 * @ClassName TimeTest
 * @Author 真正的小明被占用了
 * @Date 2018/12/23/023 11:25
 * @Version 1.0
 */
public class TimeTest {

    public static void main(String[] args) throws IOException, ClassNotFoundException, InterruptedException {
        Scanner scanner =new Scanner(System.in);
        System.out.println("in数据路径:");
        String inPutPath=scanner.nextLine();
        System.out.println("in输出数据路径");
        String outPutPath=scanner.nextLine();
        Job job =new Job();
        job.setJarByClass(TimeTest.class);//指定类
        job.setJobName("TimeTest");
        FileInputFormat.addInputPath(job,new Path(inPutPath));//定义数据输入的路径
        FileOutputFormat.setOutputPath(job,new Path(outPutPath));//定义数据输出的路径
        job.setMapperClass(TimeMap.class);//指定map类
        job.setReducerClass(TimeReduce.class);//指定reduce类
        job.setOutputKeyClass(Text.class);//指定输出类的key值类型
        job.setOutputValueClass(Text.class);//指定输出类的value值的类型
        job.setMapOutputValueClass(Text.class);//指定map类的key值类型
        job.setMapOutputValueClass(LongWritable.class);//指定map类的key值类型
        System.exit(job.waitForCompletion(true)?0:1);
    }


}
